package com.yunche.yunchebusiness.ui.activity.system

import com.yunche.yunchebusiness.R
import com.yunche.yunchebusiness.base.BaseActivity
import com.yunche.yunchebusiness.common.Constant
import com.yunche.yunchebusiness.ui.activity.main.LoginActivity
import com.yunche.yunchebusiness.ui.view.ChaosGestureView
import com.yunche.yunchebusiness.ui.view.YuncheToolBar
import com.yunche.yunchebusiness.utils.SpHelper
import kotlinx.android.synthetic.main.activity_change_gesture.*

class ChangeGestureActivity : BaseActivity(), ChaosGestureView.GestureCallBack {
    override fun gestureVerifySuccessListener(
        stateFlag: Int,
        data: MutableList<ChaosGestureView.GestureBean>?,
        success: Boolean
    ) {
        setResult(if (success) Constant.RESULT_GESTURE_SUCCESS else Constant.RESULT_GESTURE_ERROR)
        finish()
    }

    override fun setLayout(): Int = R.layout.activity_change_gesture

    override fun initView() {
        gesture.setGestureCallBack(this)
    }

    override fun initData() {
    }

    override fun onBackPressed() {
        setResult(Constant.FINISH)
        finish()
    }

    override fun initEvent() {
        toolbar.yuncheToolbarCallBack = object : YuncheToolBar.YuncheToolbarCallBack {
            override fun onBackClick() {
                onBackPressed()
            }

            override fun onRightClick() {
                SpHelper.clearPreference()
                openActivity(LoginActivity::class.java)
                finish()
            }

        }
    }


}
